package org.dxy.infrastructure.persistent.repository;

import lombok.RequiredArgsConstructor;
import org.dxy.domain.adapter.repository.IProcessRouteRepository;
import org.dxy.domain.model.valobj.ProcessRoute;
import org.dxy.domain.model.valobj.ProcessStep;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * @description:
 * @author: dxy
 * @createTime: 2025/6/7 12:17
 */
@Repository
@RequiredArgsConstructor
public class ProcessRouteRepository implements IProcessRouteRepository {

    @Override
    public Optional<ProcessRoute> findById(Long processRouteId) {

        List<ProcessStep> steps = List.of(
                ProcessStep.builder()
                        .id(1L)
                        .stepCode("步骤1")
                        .requiredDeviceType("光驱")
                        .parameters(Map.of("温度", "80", "时间", "5min"))
                        .build(),
                ProcessStep.builder()
                        .id(2L)
                        .stepCode("步骤2")
                        .requiredDeviceType("机械臂")
                        .parameters(Map.of("角度", "45", "速度", "中速"))
                        .build(),
                ProcessStep.builder()
                        .id(3L)
                        .stepCode("步骤3")
                        .requiredDeviceType("扫码器")
                        .parameters(Map.of("格式", "QR", "精度", "高"))
                        .build()
        );

        ProcessRoute processRoute = ProcessRoute.builder()
                .id(1L)
                .steps(steps)
                .build();

        return Optional.of(processRoute);
    }
}
